<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>财务支付管理系统</title>
    <meta name="description" content="这是一个 index 页面">
    <meta name="keywords" content="index">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
    <link rel="stylesheet" href="assets/css/admin.css">
    <link rel="stylesheet" href="assets/css/app.css">
    <style>
        .star::before {
            content: '*';
            color: #F56C6C;
            margin-right: 0.020833rem;
        }

        .am-selected {
            width: 100%
        }

        .am-selected-status {
            font-size: 13px;
            color: #999;
        }
    </style>
</head>
<body data-type="generalComponents">
<header class="am-topbar am-topbar-inverse admin-header">
    <div class="am-collapse am-topbar-collapse" id="topbar-collapse">
        <ul class="am-nav am-nav-pills am-topbar-nav am-topbar-right admin-header-list tpl-header-list">
            <li class="am-dropdown" data-am-dropdown data-am-dropdown-toggle>
                <a class="am-dropdown-toggle tpl-header-list-link" href="javascript:;">
                    <span class="tpl-header-list-user-nick">禁言小张</span><span class="tpl-header-list-user-ico"> <img
                        src="assets/img/user01.png"></span>
                </a>
                <ul class="am-dropdown-content">
                    <li><a href="login.html"><span class="am-icon-power-off"></span> 退出</a></li>
                </ul>
            </li>
        </ul>
    </div>
</header>
<div class="tpl-page-container tpl-page-header-fixed">
    <div class="tpl-left-nav tpl-left-nav-hover">
        <div class="tpl-left-nav-list">
            <ul class="tpl-left-nav-menu">
                <li class="tpl-left-nav-item">
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list active">
                        <i class="am-icon-table"></i>
                        <span>付款管理</span>
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right tpl-left-nav-more-ico-rotate"></i>
                    </a>
                    <ul class="tpl-left-nav-sub-menu" style="display:block">
                        <li>
                            <a href="ticket-open.html" class="active">
                                <i class="am-icon-angle-right"></i>
                                <span>开具付款凭证</span>
                            </a>

                            <a href="open-list.html">
                                <i class="am-icon-angle-right"></i>
                                <span>付款列表</span>
                            </a>
                        </li>
                    </ul>
                </li>
                <li class="tpl-left-nav-item">
                    <a href="javascript:;" class="nav-link tpl-left-nav-link-list">
                        <i class="am-icon-wpforms"></i>
                        <span>工作台</span>
                        <i class="am-icon-angle-right tpl-left-nav-more-ico am-fr am-margin-right"></i>
                    </a>
                    <ul class="tpl-left-nav-sub-menu">
                        <li>
                            <a href="check-list.html">
                                <i class="am-icon-angle-right"></i>
                                <span>付款复核</span>
                            </a>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </div>
    <div class="tpl-content-wrapper" id="showDiv">
        <div class="tpl-content-page-title">
            开具付款凭证
        </div>
        <ol class="am-breadcrumb">
            <li class="am-active"><a style="color: #999999;">付款管理</a></li>
            <li class="am-active">开具付款凭证</li>
        </ol>
        <div class="tpl-portlet-components">
            <!-- 表单填写页面 -->
            <div class="tpl-block">
                <div class="">
                    <div class="portlet-title">
                        <div class="caption font-green bold">
                            凭证信息
                        </div>
                        <div class="tpl-portlet-input tpl-fz-ml">
                            <div class="portlet-input input-small input-inline">
                                <div class="input-icon right">
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="tpl-block ">

                        <div class="am-g tpl-amazeui-form">

                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 开单企业</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <input disabled type="text" v-model="enterpriseName">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">统一社会信用代码</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <input disabled type="text" v-model="enterpriseId">
                                        </div>
                                    </div>
                                </form>
                                ,
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 收单企业</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <select @change="changeid" :value="acquirerName" v-model="acquirerName">
                                                <option>请选择收单企业</option>
                                                `
                                                <option v-for="e in enterprises " :value="e.name">
                                                    {{e.name}}
                                                </option>

                                            </select>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">统一社会信用代码 </label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <input disabled type="text" v-model="acquirerId">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 凭证金额</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <input type="text" id="user-name" placeholder="请输入凭证金额" v-model="amount">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 金融机构</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <select v-model="institutyId">
                                                <option>请选择金融机构</option>
                                                <option v-for="i in instituty" :value="i.id">{{i.name}}

                                                </option>
                                            </select>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 开单日期</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <input disabled type="text" class="am-form-field"
                                                   style="border: 1px solid #c2cad8;width: 100%;border-radius: 3px;"
                                                   v-model="createTime">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 到期日期</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <input type="date"
                                                   placeholder="请选择日期" v-model="expiryTime"
                                                   style="border: 1px solid #c2cad8;width: 100%;border-radius: 3px;">
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label star"> 付息方式</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                            <select placeholder="请选择付息方式" v-model="paymentInterestType">
                                                <option value="A">融资方付息</option>
                                                <option value="B">核心企业付息</option>
                                            </select>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                                <form class="am-form am-form-horizontal">
                                    <div class="am-form-group">
                                        <label for="user-name" class="am-u-sm-3 am-form-label">备注</label>
                                        <div class="am-u-sm-9" style="margin-top: 4px;font-size: 16px;">
                                                <textarea class="" rows="4" id="user-intro"
                                                          placeholder="请输入备注" v-model="remark"></textarea>
                                        </div>
                                    </div>
                                </form>
                            </div>
                            <div class="am-u-sm-12 am-u-md-6">
                            </div>
                        </div>
                        <div style="text-align: center;margin-top:40px">
                            <a class="am-btn am-btn-default" href="open-list.html">取&nbsp;&nbsp;&nbsp;&nbsp; 消</a>
                            <a id="submitBtn" class="am-btn am-btn-primary"
                               style="margin-left:20px" @click="tj">提&nbsp;&nbsp;&nbsp;&nbsp; 交</a>
                        </div>
                    </div>
                </div>
            </div>
            <!-- 提交成功页面 -->
            <div class="tpl-block " id="resultDiv" hidden>
                <div class="am-g tpl-amazeui-form">
                    <div class="am-u-sm-12 am-u-md-12">
                        <form class="am-form am-form-horizontal">
                            <div class="am-form-group">
                                <div class="am-u-sm-12" style="margin-top: 4px;text-align: center;margin-bottom: 20px;">
                                    <img src="assets/img/u105.png" alt="" style="width: 120px;">
                                </div>
                                <div class="am-u-sm-12"
                                     style="margin-top: 4px;font-size: 20px;text-align: center;font-weight: bold;margin-bottom: 20px;">
                                    提交申请成功
                                </div>
                                <div class="am-u-sm-12" style="color: #999;font-size:14px;text-align: center;">
                                    已通知审核人员尽快审核，最终结果将以站内信的方式告知您。
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
                <div style="text-align: center;margin-top:40px">
                    <a class="am-btn am-btn-primary" href="open-list.html">返回列表</a>
                </div>
            </div>
        </div>
    </div>
</div>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script src="assets/js/app.js"></script>
<script src="assets/js/vue.js"></script>
<script src="assets/js/axios.min.js"></script>

<script>
    // 提交按钮
    $(function () {
        $('#submitBtn').on('click', function () {
            $('#showDiv').hide();
            $('#resultDiv').show();
        });
    });
</script>
<script>

    showDiv = new Vue({
        el: "#showDiv",
        data: {
            enterpriseName: "百度有限公司",
            acquirerName: "",
            enterpriseId: "000001",
            acquirerId: "",
            enterprises: {},
            instituty: {},
            createTime: "2022-11-16",
            amount: "",
            expiryTime: "",
            paymentInterestType: "",
            institutyId: "",
            remark: "",
            account: "",
        },
        methods: {
            // 通过选择的企业不同改变对应的企业Id
            changeid: function () {
                axios.get("admin/selectId.en?acquirerName=" + this.acquirerName).then(resp => {
                    let data = resp.data;
                    console.log(data);
                    this.acquirerId = data.value
                })
            },
            tj: function () {
                let formData = new FormData;
                formData.append("enterpriseId", this.enterpriseId);
                formData.append("acquirerId", this.acquirerId);
                formData.append("amount", this.amount);
                formData.append("institutyId", this.institutyId);
                formData.append("createTime", this.createTime);
                formData.append("expiryTime", this.expiryTime);
                formData.append("paymentInterestType", this.paymentInterestType);
                formData.append("remark", this.remark);
                alert("提交成功");
                axios({
                    method: "post",
                    url: "admin/saveTicketOpen.to",
                    data: formData,
                }).then(function (resp) {
                    let data = resp.data;
                    let code = data.code;
                    if (code == 200) {
                        alert("添加成功")
                    } else if (code == 201) {
                        alert("添加失败")
                    }

                });
            },

        },
        created() {
            let href = location.href;
            let strings = href.split("=");
            console.log(strings)
            let id = strings[1];
            console.log(id);
            this.account = id;
            let _this = this;
            axios.post("admin/selectAll.en").then(resp => {
                let data = resp.data;
                _this.enterprises = data.value;
            });
            axios.post("admin/selectInstituty.in").then(resp => {
                let data = resp.data;
                _this.instituty = data.value;
            });
        },

    });
</script>
</body>
</html>